package cn.smileyan.demos.operators;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * filter 例子
 * @author smileyan
 */
public class FilterDemo {
    public static void main(String[] args) throws Exception {
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStream<Integer> fixedInput = env.fromElements(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

        DataStream<Integer> evenNumbers = fixedInput.filter(number -> number % 2 == 0);

        evenNumbers.print();

        env.execute("Flink Filter Example");
    }
}
